﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;

namespace Cloak.Mvp
{
	/// <summary>
	/// Describes a mapping between view types and presenter references
	/// </summary>
	[ContractClass(typeof(IViewPresenterIndexContract))]
	public interface IViewPresenterIndex
	{
		/// <summary>
		/// Gets the presenters mapped to the specified view type
		/// </summary>
		/// <param name="viewType">The type of view associated with the presenters</param>
		/// <returns>The presenters mapped to the specified type</returns>
		IEnumerable<IPresenterReference> GetPresenters(Type viewType);
	}

	[ContractClassFor(typeof(IViewPresenterIndex))]
	internal abstract class IViewPresenterIndexContract : IViewPresenterIndex
	{
		IEnumerable<IPresenterReference> IViewPresenterIndex.GetPresenters(Type viewType)
		{
			Contract.Requires(viewType != null);
			Contract.Ensures(Contract.Result<IEnumerable<IPresenterReference>>() != null);

			return null;
		}
	}
}